<template>
  <div class="cumi">
    <div class="cumi_top">
      <div class="from">
        <div class="fr">
          <yd-flexbox class="dl">
            <yd-flexbox-item>登录</yd-flexbox-item>
          </yd-flexbox>
          <yd-cell-group class="sumib">
            <yd-cell-item class="fr_item">
              <img slot="icon" src="../../static/login/2.png" />
              <yd-input
                slot="right"
                placeholder="请输入账号"
                required
                v-model="loginForm.username"
              ></yd-input>
            </yd-cell-item>
            <yd-cell-item class="fr_item">
              <img slot="icon" src="../../static/login/3.png" />
              <yd-input
                slot="right"
                required
                v-model="loginForm.pwd"
                type="password"
                placeholder="请输入密码"
              ></yd-input>
            </yd-cell-item>
            <yd-cell-item :style="{ display: 'flex' }" class="fr_item">
              <yd-input
                slot="left"
                v-model="loginForm.code"
                placeholder="验证码"
                class="input-style"
              ></yd-input>
              <img
                slot="right"
                src="../../image/验证码.png"
                style="width: 1.2rem;max-height:.8rem;margin-right:0"
              />
            </yd-cell-item>
            <div class="sf">
              <div class="loginsf">
                <img src="../../static/login/wxlogin.png" alt="" />
                <span @click="wxLogin">微信登录</span>
              </div>
              <div class="jz">
                <span @click="toRegister">还没有账号，点我注册？</span>
              </div>
            </div>
          </yd-cell-group>
        </div>
      </div>
      <yd-button-group style="top: 7rem;padding: 0 1.2rem;">
        <yd-button
          size="large"
          type="primary"
          shape="circle"
          @click.native="submituUserInfo"
          >登录</yd-button
        >
      </yd-button-group>
    </div>
  </div>
</template>
<script>
import { wxLogin } from '@/api';
export default {
  name: 'logins',
  data() {
    return {
      loginForm: {
        username: '',
        pwd: '',
        code: ''
      },
      show_clear: false,
      isshow: true
    };
  },
  created() {},
  methods: {
    submituUserInfo() {
      this.$store
        .dispatch('Logins', this.loginForm)
        .then(res => {
          this.$router.push({ path: '/' });
        })
        .catch(error => {
          this.$dialog.toast({
            mes: error,
            timeout: 1500,
            icon: 'error'
          });
        });
    },
    toRegister() {
      this.$router.push('/register');
    },
    wxLogin() {
      wxLogin().then(res => {
        console.log(res);
      });
    }
  }
};
</script>
<style scoped lang="less">
.dl {
  padding: 0.5rem 0rem 0rem 0.5rem;
  font-size: 0.4rem;
  font-weight: bold;
  color: #4e4b4b;
  text-align: left;
}
.cumi {
  display: flex;
  height: 100%;
  flex-direction: column;
}
.cumi_top {
  height: 4rem;
  background: url(../../static/login/head.png);
  background-size: 100% 100%;
}
.cumi_button {
  height: 70%;
  background: #ffffff;
}
.from {
  position: absolute;
  top: 1.5rem;
  left: 0rem;
  height: 6.75rem;
  width: 100%;
  padding: 0.45rem;
}
.fr {
  background: #fff;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  box-shadow: 0px 10px 15px rgba(187, 238, 242);
  -moz-box-shadow: 0px 10px 15px rgba(187, 238, 242);
  -webkit-box-shadow: 0px 10px 15px rgba(187, 238, 242);
}
.fr_item {
  height: 0.7rem;
  margin: 0.4rem 0.5rem;
}
.sumib {
  border-radius: 5px;
}
.yd-cell-icon img {
  height: 0.4rem;
  padding-right: 0.1rem;
}
/deep/.yd-cell {
  border-radius: 5px;

  &:after {
    display: none !important;
  }
}
.yd-cell-right {
  min-height: 0.7rem;
}
.yd-cell-item {
  align-items: center;
  font-weight: bolder;
}
.yd-cell:after {
  height: 0px !important;
}
.yd-cell::after {
  height: 0px !important;
}
.yd-button {
  position: relative;
}
.yd-btn-block {
  height: 0.8rem;
  margin-top: 0.45rem;
}
.yd-checkbox-text {
  font-size: 0.25rem;
}
.yd-checkbox-icon {
  margin-right: 0.1rem;
}
.jz {
  text-align: right;
  color: #3fbed4;
}
.yd-btn-primary:not(.yd-btn-loading) {
  background-image: linear-gradient(to right, #4cf7f7, #636bdf);
}

.input-style input {
  font-size: 0.32rem !important;
  letter-spacing: 1px;
  font-weight: 500;
  width: 4rem;
}
.sf {
  display: flex;
  padding: 0rem 0.7rem;
  color: #999;
  align-items: center;
  justify-content: space-between;
}
.loginsf {
  font-size: 0.28rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loginsf img {
  height: 0.5rem;
  padding-right: 0.15rem;
}
</style>
